1 Public Class FrmPURCHASEORDERLIST
2
3     Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
4         Me.Close()
5     End Sub
6
7     Private Sub FrmPURCHASEORDERLIST_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
8         sqlSTR =
"SELECT TBL_Category_File.Catg_ID, TBL_Category_File.Catg_Name " & _
9                  
"FROM TBL_Category_File WHERE TBL_Category_File.Catg_ID IN " & _
10                  
"(SELECT Catg_ID FROM TBL_Suppliers_Product WHERE Supp_ID=" & Split(FrmPURCHASEORDERADD.cmbsupplier.Text, " - ")(0) & ")"
11         FILLComboBox(sqlSTR, cmblist)
12         listitems.Items.Clear()
13         
'listitems.Items(0).ForeColor = Color.Beige
14
15     End Sub
16
17     Private Sub cmblist_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmblist.SelectedIndexChanged
18         sqlSTR =
"SELECT TBL_Category_Item_File.Item_ID as 'Item ID', Replace(Replace(TBL_Category_Item_File.Item_Name,'$.$',''''),'$..$',',') as 'Name', TBL_Category_Item_File.Item_Description as 'Description / Item Number', TBL_Suppliers_Product.Item_Price as 'Price', TBL_Category_Item_File.Item_Barcode as 'Barcode', TBL_Category_Item_File.Unit_Measure as 'Measure' " & _
19                  
"FROM ((TBL_Category_Item_File " & _
20                  
"INNER JOIN TBL_Suppliers_Product ON TBL_Category_Item_File.Item_ID = TBL_Suppliers_Product.Item_ID) " & _
21                  
"INNER JOIN TBL_Suppliers ON TBL_Suppliers_Product.Supp_ID = TBL_Suppliers.Supp_ID) " & _
22                  
"WHERE TBL_Suppliers.Supp_ID = " & Split(FrmPURCHASEORDERADD.cmbsupplier.Text, " - ")(0) & _
23                  
" AND tbl_Category_Item_File.Catg_ID =" & Split(cmblist.Text, " - ")(0)
24         FillListView(ExecuteSQLQuery(sqlSTR), listitems,
0)
25         
'FillListView(ExecuteSQLQuery("SELECT Item_ID as 'Item ID', Item_Name as 'Name', Item_Description as 'Description', Item_Price as 'Price' FROM tbl_Category_Item_File WHERE Catg_ID =" & Split(cmblist.Text, " - ")(0)), listitems, 1)
26     End Sub
27
28     Private Sub CmdSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSelect.Click
29         
'listitems.Focus()
30         If listitems.Items.Count >
0 Then
31             listitems.Focus()
32             FrmPURCHASEORDERDATA.txtid.Text = listitems.FocusedItem.Text
33             FrmPURCHASEORDERDATA.txtname.Text = listitems.FocusedItem.SubItems(
1).Text
34             FrmPURCHASEORDERDATA.txtdesc.Text = listitems.FocusedItem.SubItems(
2).Text
35             FrmPURCHASEORDERDATA.txtprice.Text = listitems.FocusedItem.SubItems(
3).Text
36             FrmPURCHASEORDERDATA.txtbarcode.Text = listitems.FocusedItem.SubItems(
4).Text
37             FrmPURCHASEORDERDATA.txtunit.Text = listitems.FocusedItem.SubItems(
5).Text
38         Else
39             MsgBox(
"No Item Selected !", MsgBoxStyle.Information, "Sales and Inventory")
40             Exit Sub
41         End If
42         Me.Close()
43     End Sub
44 End Class


Gõ tìm kiếm nhanh...